package cn.tedu.boot.demo.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils;

@Component
public class GlobalPasswordEncoder {

    @Autowired
    private PasswordEncoder passwordEncoder;

    /**
     * 执行加密
     * @param rawPassword  明文密码(原文)
     * @return 密文密码(加密后的结果)
     */
    public String encode(String rawPassword){
        return passwordEncoder.encode(rawPassword);
    }
}
